package fc.sj.study.activity.imactivity;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;

import fc.sj.study.R;
import io.rong.imkit.RongIM;
import io.rong.imkit.model.UIConversation;
import io.rong.imlib.model.Conversation;
import io.rong.message.ContactNotificationMessage;

public class SubConversationListActivtiy extends FragmentActivity implements RongIM.ConversationListBehaviorListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sub_conversation_list_activtiy);
    }

    @Override
    public boolean onConversationPortraitClick(Context context, Conversation.ConversationType conversationType, String s) {
        return false;
    }

    @Override
    public boolean onConversationPortraitLongClick(Context context, Conversation.ConversationType conversationType, String s) {
        return false;
    }

    @Override
    public boolean onConversationLongClick(Context context, View view, UIConversation uiConversation) {
        return false;
    }

    @Override
    public boolean onConversationClick(Context context, View view, UIConversation uiConversation) {
        if (uiConversation.getMessageContent() instanceof ContactNotificationMessage) {
            ContactNotificationMessage message = (ContactNotificationMessage) uiConversation.getMessageContent();
            if (message.getOperation().equals(ContactNotificationMessage.CONTACT_OPERATION_REQUEST)) {
                //这里进行你自己的操作，我是启动了另一个Activity来处理这个消息
//                context.startActivity(intent);
            } else if (message.getOperation().equals(ContactNotificationMessage.CONTACT_OPERATION_ACCEPT_RESPONSE)) {
            } else if (message.getOperation().equals(ContactNotificationMessage.CONTACT_OPERATION_REJECT_RESPONSE)) {
            }


            return true;
        } else {
            return false;
        }
    }
}
